package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class TravelQuery extends QueryObject{

    private Long destId = -1L;

    private int perExpendType = -1;  //人均消费
    private int travelTimeType = -1;    //旅游时间(月份)
    private int dayType = -1;       //旅游天数

    private int orderType = 1;  //排序 默认是最新

    private String orderBy = "t.createTime desc ";  //默认是最新



    public String getOrderBy(){
        return orderType == 1?"t.createTime desc" : "t.viewnum desc";
    }

    //将页面传入key值转换成范围对象
//    public TravelCondition getPerExpend(){
//        return TravelCondition.TRAVEL_PER_EXPEND.get(perExpendType);
//    }
//    //旅游时间
//    public TravelCondition getTravelTime(){
//        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
//    }
//    //旅游天数
//    public TravelCondition getDay(){
//        return TravelCondition.TRAVEL_DAYS.get(dayType);
//    }

    // 页面传入的 dayType = 2 转换成想要的范围对象
    public TravelCondition getDays(){
        return TravelCondition.DAYSMAP.get(dayType);
    }

    // 月份
    public TravelCondition getTravelTime(){
        return TravelCondition.TIMEMAP.get(travelTimeType);
    }

    // 人均
    public TravelCondition getPerExpend(){
        return TravelCondition.PRE_EXPENDSMAP.get(perExpendType);
    }


}
